package flexibility;

import java.io.*;

public class serverIP {
	String path = "c:/serverConf.txt";
	public String host;
	public int port;

	public void getServerConf() {
		int i = 0;
		try {
			// Open the file that is the first
			// command line parameter
			FileInputStream fstream = new FileInputStream(path);
			// Get the object of DataInputStream
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String strLine;
			// Read File Line By Line
			while ((strLine = br.readLine()) != null) {
				// Print the content on the console
				if (i == 1) {// get host
					host = strLine;
				}
				if (i == 3) {// get port
					port = Integer.parseInt(strLine);
				}
				i++;
			}
			// Close the input stream
			in.close();
		} catch (Exception e) {// Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}
	}
}
